Ext.define('WebOs.Kernel.model.UIServiceBase',{
	extend : 'WebOs.Kernel.model.ServiceBase',
	
	isUI : true,
	isMVC : true,
	
    constructor : function(config){
		var me = this;
		me.callParent([config]);
	},
	
	start : function(config){
		var me = this;
		Ext.applyIf(me,config);
		var vf = core.getActiveView();
		if(vf){
			if(me.isMVC && me.ctrlCls){
				var app = vf.getApplication();
				if(app){
					var ctrl = app.getController(me.ctrlCls);
					if(!ctrl.inited){
						ctrl.init(app,config);
						ctrl.inited = true;
					}else{
						Ext.apply(ctrl,config);
					}
				}
			}
			vf.showUI(me);
		}
		me.callParent(arguments);
	},
	
	stop : function(){
		var me = this;
		var vf = me.kernel.vmgr.getActiveFrame();
		if(vf){
			vf.closeUI(me.name);
		}
		me.callParent(arguments);
	}
});